/**
 * 
 */
package vanhoc.android.mediakool.custom.adapter;

import java.util.ArrayList;
import java.util.List;

import vanhoc.android.medialcool.item.data.MusicItemData;
import vanhoc.android.medialcool.item.layout.AlbumGenreItemView;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;

/**
 * @author Administrator
 *
 */
public class MusicListAdapter extends ArrayAdapter<MusicItemData> {

	private Context aContext;
	private ArrayList<MusicItemData> arrListAlbumData;
	
	//Bien luu ten album chua bai hat dang dc choi (neu co)
	private String albumTitle;
	
	//Bien luu ten genre chua bai hat dang dc choi (neu co)
	private String genreTitle;
	
	public MusicListAdapter(Context context, int textViewResourceId,
			List<MusicItemData> objects) {
		super(context, textViewResourceId, objects);
		// TODO Auto-generated constructor stub
		
		this.aContext	=	context;
		this.arrListAlbumData	=	(ArrayList<MusicItemData>) objects;
	}
	
	
	
	public void setAlbumTitle(String title){
		this.albumTitle = title;
	}
	
	
	
	public void setGenreTitle(String title){
		this.genreTitle = title;
	}
	
	
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		AlbumGenreItemView itemView;
		
		itemView	=	new AlbumGenreItemView(aContext);
		itemView.txtTitle.setText(arrListAlbumData.get(position).getTitle());
		itemView.txtDesc.setText(arrListAlbumData.get(position).getDescription());
		
		if (arrListAlbumData.get(position).getTitle().equals(this.albumTitle) || arrListAlbumData.get(position).getTitle().equals(this.genreTitle)) {
			itemView.current_playing_icon.setImageResource(vanhoc.android.mediakool.R.drawable.next_16_icon);
		}
			
		return itemView;
	}

}
